package velox.jcr.mapper;

import java.util.Collection;
import java.util.List;


public interface PersistentCollection {
	public List<Entry> getChangeLog();
	public boolean isLoaded();
	
	public static class Utils {
		public static void initialize(Collection<?> c) {
			if (c instanceof LazyList) {
				((LazyList<?>) c).load();
			}
		}
	}
	
	public static class Entry {
		public enum Operation {
			ADD, REMOVE
		}

		private Object entity;
		private Operation operation;

		public Entry(Object entity, Operation operation) {
			super();
			this.entity = entity;
			this.operation = operation;
		}

		public Object getEntity() {
			return entity;
		}

		public Operation getOperation() {
			return operation;
		}
	}
}
